﻿Imports CustomTshirtFinal

Public Class ProductoEliminar
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim id = Request.Params.Get("id")

        Dim negocio = New ProductoNegocio
        Dim modelo = negocio.obtener(id)

        Me.txtIdProducto.Value = modelo.idProducto
        Me.txtNombre.Text = modelo.nombre
        Me.txtDescripcion.Text = modelo.descripcion
        Me.txtPrecio.Text = modelo.precio
        Me.txtStock.Text = modelo.stock
        Me.txtImportancia.Text = modelo.importancia
    End Sub

    Protected Sub btnGuardar_Click(sender As Object, e As EventArgs) Handles btnGuardar.Click
        Try
            Dim negocio = New ProductoNegocio
            negocio.eliminar(Me.txtIdProducto.Value)
            Response.Redirect("Productos.aspx", True)
        Catch ex As Exception
            Response.Write("No se pudo eliminar")
        End Try
    End Sub

    Protected Sub btnRegresar_Click(sender As Object, e As EventArgs) Handles btnRegresar.Click
        Response.Redirect("Productos.aspx", True)
    End Sub
End Class